<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2022/10/6
  Time: 17:50
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<html>
<head>
    <base href="${pageContext.request.contextPath}/">
    <title>电影信息列表</title>
    <style>
        table tr:nth-child(odd) {
            background: lightgray;
        }

        a {
            text-decoration: none;
        }
    </style>
</head>
<body>
<h1 align="center">电影信息列表</h1>
<form action="add.jsp" method="post">
    <input type="submit" value="添加电影" style="margin-left: 513px">
    <table align="center" border="1px">
        <tr>
            <th>电影名称</th>
            <th>电影类型</th>
            <th>价格</th>
            <th>是否推荐</th>
            <th>上映时间</th>
            <th>下映时间</th>
            <th>投票数</th>
        </tr>
        <c:forEach var="movie" items="${sessionScope.list}">
            <tr align="center">
                <td>${movie.movieName}</td>
                <td>${movie.movieType}</td>
                <td>${movie.price}</td>
                <c:if test="${movie.recommend==1}">
                    <td>推荐</td>
                </c:if>
                <c:if test="${movie.recommend==0}">
                    <td>不推荐</td>
                </c:if>
                <td>${movie.startTime}</td>
                <td>${movie.endTime}</td>
                <td>${movie.votes}</td>
            </tr>
        </c:forEach>
    </table>
</form>
<div align="center">
    <a href="ListServlet?pageNo=1">首页</a>
    <a href="ListServlet?pageNo=${sessionScope.pageNo-1}">上一页</a>
    <a href="ListServlet?pageNo=${sessionScope.pageNo+1}">下一页</a>
    <a href="ListServlet?pageNo=${sessionScope.totalPages}">尾页</a>
    <span>第${sessionScope.pageNo}页，共${sessionScope.totalPages}页，总记录数${sessionScope.count}条</span>
</div>
<script src="jq/jquery.js"></script>
<script>
    $(function () {
        if(${sessionScope.msg==true}){
            alert("添加成功");
        }else if(${sessionScope.msg==false}){
            alert("添加失败");
        }
        ${sessionScope.remove("msg")}
    })
</script>
</body>
</html>
